<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link type="text/css" rel="stylesheet" href="../statics/css/style.css" />
<!--[if IE 6]>
    <script src="js/iepng.js" type="text/javascript"></script>
        <script type="text/javascript">
           EvPNG.fix('div, ul, img, li, input, a'); 
        </script>
    <![endif]-->
<script type="text/javascript"
	src="../statics/js/jquery-1.11.1.min_044d0927.js"></script>
<script type="text/javascript"
	src="../statics/js/jquery.bxslider_e88acd1b.js"></script>

<script type="text/javascript" src="../statics/js/jquery-1.8.2.min.js"></script>
<script type="text/javascript" src="../statics/js/menu.js"></script>

<script type="text/javascript" src="../statics/js/select.js"></script>

<script type="text/javascript" src="../statics/js/lrscroll.js"></script>

<script type="text/javascript" src="../statics/js/iban.js"></script>
<script type="text/javascript" src="../statics/js/fban.js"></script>
<script type="text/javascript" src="../statics/js/f_ban.js"></script>
<script type="text/javascript" src="../statics/js/mban.js"></script>
<script type="text/javascript" src="../statics/js/bban.js"></script>
<script type="text/javascript" src="../statics/js/hban.js"></script>
<script type="text/javascript" src="../statics/js/tban.js"></script>

<script type="text/javascript" src="../statics/js/lrscroll_1.js"></script>
<script type="text/javascript">
	function check() {
		var sex = document.getElementsByName("sex");
		if ($("#userName").val() == "") {
			alert("真实姓名不能为空");
			$("#userName").focus();
			return false;
		} else if ($("#loginUser").val() == "") {
			alert("用户名不能为空！请重新填入！");
			$("#loginUser").focus();
			return false;
		} else if ($("#loginPwd").val() == "") {
			alert("密码不能为空！请重新填入！");
			$("#loginPwd").focus();
			return false;
		} else if ($("#loginPwdTwo").val() == "") {
			alert("重复密码不能为空！请重新填入！");
			$("#loginPwdTwo").focus();
			return false;
		} else if ((sex[0].checked == false) && (sex[1].checked == false)) {
			alert("请选择性别");
			return false;
		} else if($("#phone").val() == ""){
			alert("手机号不能为空！请重新填入！");
			$("#phone").focus();
			return false;
		}
		if ($("#loginPwd").val() !=$("#loginPwdTwo").val()) {
			alert("两次输入密码不符")
			return false;
		}
		if($("#loginPwd").val().length<6||$("#loginPwd").val().length>20){
			alert("密码只能是6-20位");
			return false
		}
	}
	$(function() {
		//为输入框绑定事件
		$("#loginUser").blur(function() {
			//1失去焦点，获得表单输入数据
			//var usernameInput = $(username).val();
			var username = $(this).val();
			//alert(usernameInput);
			//2去服务端校验该用户名是否存在--ajax将用户名提交到服务器校验
			$.ajax({
				url : "UserRegister",
				type : "GET",
				data : {
					"username" : username,
					"action" : "checkUserName"
				},
				dataType : "json",
				success : function(data) {
					var isExit = data.isExist;
					//3根据返回的isExit动态显示信息
					var usernameInfo = "";
					if (isExit) {
						//                 //该用户名存在
						usernameInfo = "该用户名已经存在";
						$("#NameInfo").css("color", "red");
					} else {
						usernameInfo = "该用户名可以使用";
						$("#NameInfo").css("color", "green");
					}
					$("#NameInfo").html(usernameInfo);
				}
			});
		});
		$("#email").blur(function() {
				var emailReg = /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(.[a-zA-Z0-9_-])+/;
				if (!emailReg.test($(this).val())) {
					alert("邮箱不符合规则");
				}
			})
		$("#phone").blur(function() {
			var phoneReg = /^1[0-9]{10}$/;
			if (!phoneReg.test($(this).val())) {
				alert("手机号不符合规则");
			}
		})
		$("#identityCode").blur(function() {
			var idReg = /^\d{18}$/;
			if (!idReg.test($(this).val())) {
				alert("身份证号码不符合规则");
			}
		})
	});
</script>

<title>二组牛逼</title>
</head>
<body>
	<!--Begin Header Begin-->
	<%@ include file="../common/header.jsp"%>
	<!--End Header End-->
	<!--Begin Login Begin-->
	<div class="log_bg">
		<div class="top">
			<div class="logo">
				<a href="Index.html"><img src="../statics/images/logo.png" /> </a>
			</div>
		</div>
		<div class="regist">
			<div class="log_img">
				<img src="../statics/images/l_img.png" width="611" height="425" />
			</div>
			<div class="reg_c">
				<form action="UserRegister" method="post" onsubmit="return check()">
					<table border="0"
						style="width:420px; font-size:14px; margin-top:20px;"
						cellspacing="0" cellpadding="0">
						<tr height="50" valign="top">
							<td width="95">&nbsp;</td>
							<td><span class="fl" style="font-size:24px;">注册</span> <span
								class="fr">已有商城账号，<a href="Login.jsp"
									style="color:#ff4e00;">我要登录</a> </span></td>
						</tr>
						<tr height="50">
							<td align="right"><font color="#ff4e00">*</font>真实姓名 &nbsp;</td>
							<td><input type="text" value="" class="l_mem" id="userName"
								name="userName" />
							</td>
						</tr>
						<tr height="50">
							<td align="right"><font color="#ff4e00">*</font>&nbsp;用户名
								&nbsp;</td>
							<td><input type="text" value="" class="l_user"
								name="loginUser" id="loginUser" /><span id="NameInfo"></span>
							</td>
						</tr>
						<tr height="50">
							<td align="right"><font color="#ff4e00">*</font>&nbsp;密码
								&nbsp;</td>
							<td><input type="password" value="" class="l_pwd"
								name="loginPwd" id="loginPwd" />
							</td>
						</tr>
						<tr height="50">
							<td align="right"><font color="#ff4e00">*</font>&nbsp;确认密码
								&nbsp;</td>
							<td><input type="password" value="" class="l_pwd"
								name="loginPwdTwo" id="loginPwdTwo" />
							</td>
						</tr>
						<tr height="50">
							<td align="right"><font color="#ff4e00">*</font>&nbsp;性别
								&nbsp;</td>
							<td>
								&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <input
								type="radio" name="sex" value="1"> <label>男</label>
								&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <input
								type="radio" name="sex" value="0"><label>女</label></td>
						</tr>
						<tr height="50">
							<td align="right">&nbsp;邮箱 &nbsp;</td>
							<td><input type="text" value="" class="l_email" name="email"
								id="email" /></td>
						</tr>
						<tr height="50">
							<td align="right"><font color="#ff4e00">*</font>&nbsp;手机号 &nbsp;</td>
							<td><input type="text" value="" class="l_tel" name="phone"
								id="phone" /></td>
						</tr>
						<tr height="50">
							<td align="right">&nbsp;身份证号 &nbsp;</td>
							<td><input type="text" value="" class="l_tel"
								name="identityCode" id="identityCode" />
							</td>
						</tr>
						<!--  <tr height="50">
                <td align="right"> <font color="#ff4e00">*</font>&nbsp;验证码 &nbsp;</td>
                <td>
                    <input type="text" value="" class="l_ipt" />
                    <a href="#" style="font-size:12px; font-family:'宋体';">换一张</a>
                </td>
              </tr> -->
						<tr>
							<td>&nbsp;</td>
							<td style="font-size:12px; padding-top:20px;"><span
								style="font-family:'宋体';" class="fl"> <label
									class="r_rad"><input type="checkbox" /> </label><label
									class="r_txt">我已阅读并接受《用户协议》</label> </span></td>
						</tr>
						<tr height="60">
							<td>&nbsp;</td>
							<td><input type="submit" value="立即注册" class="log_btn" />
							</td>
						</tr>
					</table>
				</form>
			</div>
		</div>
	</div>
	<!--End Login End-->
	<!--Begin Footer Begin-->
	<%@include file="../common/LoginAndReg_Footer.jsp"%>
	<!--End Footer End -->

</body>
</html>
